home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / muds / mordor_2.000 / mordor_2 / src / dm2.c < prev    next >
C/C++ Source or Header  |  1995-06-28  |  21KB  |  660 lines

  1. /*
  2.  * DM2.C:
  3.  *
  4.  *    DM functions
  5.  *
  6.  *    Copyright (C) 1991, 1992, 1993 Brett J. Vickers
  7.  *
  8.  */
  9.  
  10. #include "mstruct.h"
  11. #include "mextern.h"
  12.  
  13. /************************************************************************/
  14. /*                dm_stat                    */
  15. /************************************************************************/
  16.  
  17. /*  This function will allow a DM to display information on an object    */
  18. /*  creature, player, or room.                        */
  19.  
  20. int dm_stat(ply_ptr, cmnd)
  21. creature    *ply_ptr;
  22. cmd        *cmnd;
  23. {
  24.     room        *rom_ptr;
  25.     object        *obj_ptr;
  26.     creature    *crt_ptr;
  27.     creature    *ply_ptr2;
  28.     char        str[2048];
  29.     int        fd, n, i, j;
  30.  
  31.     if(ply_ptr->class < CARETAKER)
  32.         return(PROMPT);
  33.  
  34.     fd = ply_ptr->fd;
  35.  
  36.     /* Give stats on room DM is in or specified room # */
  37.     if(cmnd->num < 2) {
  38.         if(cmnd->val[0] >= RMAX) return(0);
  39.         if(cmnd->val[0] == 1)
  40.             rom_ptr = ply_ptr->parent_rom;
  41.         else {
  42.             if(load_rom(cmnd->val[0], &rom_ptr) < 0) {
  43.                 print(ply_ptr->fd, "Error (%d)\n", cmnd->val[0]);
  44.                 return(0);
  45.             }
  46.         }
  47.  
  48.         stat_rom(ply_ptr, rom_ptr);
  49.         return(0);
  50.     }
  51.  
  52.     /*  Use player reference through 2nd parameter or default to DM */
  53.     if(cmnd->num < 3)
  54.         ply_ptr2 = ply_ptr;
  55.     else {
  56.         ply_ptr2 = find_crt(ply_ptr, ply_ptr->parent_rom->first_mon,
  57.                     cmnd->str[2], cmnd->val[2]);
  58.         cmnd->str[2][0] = up(cmnd->str[2][0]);
  59.         if(!ply_ptr2)
  60.             ply_ptr2 = find_crt(ply_ptr,
  61.                         ply_ptr->parent_rom->first_ply,
  62.                         cmnd->str[2], cmnd->val[2]);
  63.         if(!ply_ptr2)
  64.             ply_ptr2 = find_who(cmnd->str[2]);
  65.         if(!ply_ptr2 || (ply_ptr->class<DM && 
  66.            F_ISSET(ply_ptr2, PDMINV)))
  67.             ply_ptr2 = ply_ptr;
  68.     }
  69.  
  70.     rom_ptr = ply_ptr2->parent_rom;
  71.  
  72.     /* Give info on object, if found */
  73.     obj_ptr = find_obj(ply_ptr2, ply_ptr2->first_obj, cmnd->str[1], 
  74.                cmnd->val[1]);
  75.     if(!obj_ptr) {
  76.         for(i=0,j=0; i<MAXWEAR; i++) {
  77.             if(EQUAL(ply_ptr2->ready[i], cmnd->str[1])) {
  78.                 j++;
  79.                 if(j == cmnd->val[1]) {
  80.                     obj_ptr = ply_ptr2->ready[i];
  81.                     break;
  82.                 }
  83.             }
  84.         }
  85.     }
  86.     if(!obj_ptr)
  87.         obj_ptr = find_obj(ply_ptr2, rom_ptr->first_obj,
  88.                    cmnd->str[1], cmnd->val[1]);
  89.  
  90.     if(obj_ptr) {
  91.         stat_obj(ply_ptr, obj_ptr);
  92.         return(0);
  93.     }
  94.  
  95.     /*  Search for creature or player to get info on */
  96.     crt_ptr = find_crt(ply_ptr, rom_ptr->first_mon, cmnd->str[1],
  97.                cmnd->val[1]);
  98.     cmnd->str[1][0] = up(cmnd->str[1][0]);
  99.     if (!crt_ptr)
  100.         crt_ptr = find_crt(ply_ptr, rom_ptr->first_ply, cmnd->str[1],
  101.                    cmnd->val[1]);
  102.     if(!crt_ptr)
  103.         crt_ptr = find_who(cmnd->str[1]);
  104.     if(crt_ptr && !(ply_ptr->class<CARETAKER && F_ISSET(crt_ptr, PDMINV))) {
  105.         stat_crt(ply_ptr, crt_ptr);
  106.         return(0);
  107.     }
  108.  
  109.     else
  110.         print(fd, "Unable to locate.\n");
  111.  
  112.     return(0);
  113.  
  114. }
  115.  
  116. /************************************************************************/
  117. /*                stat_rom                */
  118. /************************************************************************/
  119.  
  120. /*  Display information on room given to player given.            */
  121.  
  122. int stat_rom(ply_ptr, rom_ptr)
  123. creature    *ply_ptr;
  124. room        *rom_ptr;
  125. {
  126.     int        i, fd;
  127.     char        str[1024];
  128.     xtag        *next_xtag;
  129.     exit_        *ext;
  130.  
  131.     fd = ply_ptr->fd;
  132.  
  133.     print(fd, "Room #: %d\n", rom_ptr->rom_num);
  134.     print(fd, "Name: %s\n", rom_ptr->name);
  135.  
  136.     print(fd, "Traffic: %d%%\n", rom_ptr->traffic);
  137.     print(fd, "Random monsters:");
  138.     for(i=0; i<10; i++)
  139.         print(fd, " %3hd", rom_ptr->random[i]);
  140.     print(fd, "\n");
  141.  
  142.     if (rom_ptr->lolevel || rom_ptr->hilevel){
  143.         print(fd, "Level Boundary: ");
  144.         if (rom_ptr->lolevel)
  145.             print(fd,"%d+ level  ",rom_ptr->lolevel);
  146.         if (rom_ptr->hilevel)
  147.             print(fd,"%d- level  ",rom_ptr->hilevel);
  148.         print(fd,"\n");
  149.     }
  150.  
  151.     if (rom_ptr->trap) {
  152.         print(fd, "Trap type: ");    
  153.         switch(rom_ptr->trap){
  154.            case TRAP_PIT:
  155.             print(fd,"Pit Trap (exit rm %d)\n",
  156.                 rom_ptr->trapexit);
  157.             break;
  158.            case TRAP_DART:
  159.             print(fd,"Poison Dart Trap\n");
  160.             break;
  161.            case TRAP_BLOCK:
  162.             print(fd,"Falling Block Trap\n");
  163.             break;
  164.            case TRAP_MPDAM:
  165.             print(fd,"MP Damage Trap\n");
  166.             break;
  167.            case TRAP_RMSPL:
  168.             print(fd,"Negate Spell Trap\n");
  169.             break;
  170.            case TRAP_NAKED:
  171.             print(fd,"Naked Trap\n");
  172.             break;
  173.            case TRAP_ALARM:
  174.             print(fd," Alarm Trap (guard rm %d)\n",
  175.                 rom_ptr->trapexit);
  176.             break;
  177.            default:
  178.             print(fd,"inalid trap #\n");
  179.            break;
  180.         }
  181.     }
  182.     strcpy(str, "Flags set: ");
  183.     if(F_ISSET(rom_ptr, RSHOPP)) strcat(str, "Shoppe, ");
  184.     if(F_ISSET(rom_ptr, RDUMPR)) strcat(str, "DumpRoom, ");
  185.     if(F_ISSET(rom_ptr, RPAWNS)) strcat(str, "PawnShop, ");
  186.     if(F_ISSET(rom_ptr, RTRAIN)) strcat(str, "train, ");
  187.     if(F_ISSET(rom_ptr, RREPAI)) strcat(str, "Repair, ");
  188.     if(F_ISSET(rom_ptr, RDARKR)) strcat(str, "DarkAlways, ");
  189.     if(F_ISSET(rom_ptr, RDARKN)) strcat(str, "DarkNight, ");
  190.     if(F_ISSET(rom_ptr, RPOSTO)) strcat(str, "PostOffice, ");
  191.     if(F_ISSET(rom_ptr, RNOKIL)) strcat(str, "NoPlyKill, ");
  192.     if(F_ISSET(rom_ptr, RNOTEL)) strcat(str, "NoTeleport, ");
  193.     if(F_ISSET(rom_ptr, RHEALR)) strcat(str, "HealFast, ");
  194.     if(F_ISSET(rom_ptr, RONEPL)) strcat(str, "OnePlayer, ");
  195.     if(F_ISSET(rom_ptr, RTWOPL)) strcat(str, "TwoPlayer, ");
  196.     if(F_ISSET(rom_ptr, RTHREE)) strcat(str, "ThreePlyr, ");
  197.     if(F_ISSET(rom_ptr, RNOMAG)) strcat(str, "NoMagic, ");
  198.     if(F_ISSET(rom_ptr, RPTRAK)) strcat(str, "PermTrack, ");
  199.     if(F_ISSET(rom_ptr, REARTH)) strcat(str, "Earth, ");
  200.     if(F_ISSET(rom_ptr, RWINDR)) strcat(str, "Wind, ");
  201.     if(F_ISSET(rom_ptr, RFIRER)) strcat(str, "Fire, ");
  202.     if(F_ISSET(rom_ptr, RWATER)) strcat(str, "Water, ");
  203.     if(F_ISSET(rom_ptr, RPLWAN)) strcat(str, "Groupwander, ");
  204.     if(F_ISSET(rom_ptr, RPHARM)) strcat(str, "PHarm, ");
  205.     if(F_ISSET(rom_ptr, RPPOIS)) strcat(str, "P-Poision, ");
  206.     if(F_ISSET(rom_ptr, RPMPDR)) strcat(str, "P-mp Drain, ");
  207.     if(F_ISSET(rom_ptr, RPBEFU)) strcat(str, "Confusion, ");
  208.     if(F_ISSET(rom_ptr, RNOLEA)) strcat(str, "No Summon, ");
  209.     if(F_ISSET(rom_ptr, RPLDGK)) strcat(str, "Pledge, ");
  210.     if(F_ISSET(rom_ptr, RRSCND)) strcat(str, "Rescind, ");
  211.     if(F_ISSET(rom_ptr, RNOPOT)) strcat(str, "No Potion, ");
  212.     if(F_ISSET(rom_ptr, RPMEXT)) strcat(str, "Pmagic, ");
  213.     if(F_ISSET(rom_ptr, RNOLOG)) strcat(str, "NoLog, ");
  214.     if(F_ISSET(rom_ptr, RELECT)) strcat(str, "Elect, ");
  215.     if(strlen(str) > 13) {
  216.         str[strlen(str)-2] = '.';
  217.         str[strlen(str)-1] = 0;
  218.     }
  219.     else
  220.         strcat(str, "None.");
  221.  
  222.     print(fd, "%s\n", str);
  223.  
  224.     print(fd, "Exits:\n");
  225.     next_xtag = rom_ptr->first_ext;
  226.     while(next_xtag) {
  227.         ext = next_xtag->ext;
  228.         print(fd, "  %s: %d", ext->name, ext->room);
  229.  
  230.         *str = 0;
  231.         if(F_ISSET(ext, XSECRT)) strcat(str, "Secret, ");
  232.         if(F_ISSET(ext, XINVIS)) strcat(str, "Invisible, ");
  233.         if(F_ISSET(ext, XLOCKD)) strcat(str, "Locked, ");
  234.         if(F_ISSET(ext, XCLOSD)) strcat(str, "Closed, ");
  235.         if(F_ISSET(ext, XLOCKS)) strcat(str, "Lockable, ");
  236.         if(F_ISSET(ext, XCLOSS)) strcat(str, "Closable, ");
  237.         if(F_ISSET(ext, XUNPCK)) strcat(str, "Un-pick, ");
  238.         if(F_ISSET(ext, XNAKED)) strcat(str, "Naked, ");
  239.         if(F_ISSET(ext, XCLIMB)) strcat(str, "ClimbUp, ");
  240.         if(F_ISSET(ext, XREPEL)) strcat(str, "ClimbRepel, ");
  241.         if(F_ISSET(ext, XDCLIM)) strcat(str, "HardClimb, ");
  242.         if(F_ISSET(ext, XFLYSP)) strcat(str, "Fly, ");
  243.         if(F_ISSET(ext, XFEMAL)) strcat(str, "Female, ");
  244.         if(F_ISSET(ext, XMALES)) strcat(str, "Male, ");
  245.         if(F_ISSET(ext, XNGHTO)) strcat(str, "Night, ");
  246.         if(F_ISSET(ext, XDAYON)) strcat(str, "Day, ");
  247.         if(F_ISSET(ext, XNOSEE)) strcat(str, "No-See, ");
  248.         if(F_ISSET(ext, XPGUAR)) strcat(str, "P-Guard, ");
  249.         if(F_ISSET(ext, XPLDGK))
  250.             if(F_ISSET(ext, XKNGDM)) strcat(str, "Organization 1, ");
  251.             else strcat(str, "Organization 0, ");
  252.  
  253.         if(*str) {
  254.             str[strlen(str)-2] = '.';
  255.             str[strlen(str)-1] = 0;
  256.             print(fd, ", Flags: %s\n", str);
  257.         }
  258.         else
  259.             print(fd, ".\n");
  260.         
  261.         next_xtag = next_xtag->next_tag;
  262.     }
  263. }
  264.  
  265. /************************************************************************/
  266. /*                stat_crt                */
  267. /************************************************************************/
  268.  
  269. /*  Display information on creature given to player given.        */
  270.  
  271. int stat_crt(ply_ptr, crt_ptr)
  272. creature    *ply_ptr;
  273. creature    *crt_ptr;
  274. {
  275.     char        str[1024], temp[20];
  276.     int        i, fd;
  277.  
  278.     fd = ply_ptr->fd;
  279.  
  280.     if(crt_ptr->type == PLAYER && Ply[crt_ptr->fd].io) {
  281.         print(fd, "\n%s the %s:\n", crt_ptr->name, title_ply(crt_ptr));
  282.         print(fd, "Addr: %s@%s\n\n", Ply[crt_ptr->fd].io->userid,
  283.             Ply[crt_ptr->fd].io->address);
  284.     }
  285.     else {
  286.         print(fd, "Name: %s\n", crt_ptr->name);
  287.         print(fd, "Desc: %s\n", crt_ptr->description);
  288.         print(fd, "Talk: %s\n", crt_ptr->talk);
  289.             print(fd, "Keys: %s %+20s%+20s\n\n",crt_ptr->key[0],crt_ptr->key[1], crt_ptr->key[2]);
  290.  
  291.     }
  292.  
  293.     print(fd, "Level: %-20d       Race: %s\n",
  294.         crt_ptr->level, race_str[crt_ptr->race]);
  295.     print(fd, "Class: %-20s  Alignment: %s %d\n\n",
  296.         class_str[crt_ptr->class],
  297.         F_ISSET(crt_ptr, PCHAOS) ? "Chaotic":"Lawful", crt_ptr->alignment);
  298.  
  299.     print(fd, "Exp: %d", crt_ptr->experience);
  300.     print(fd, "   Gold: %d\n", crt_ptr->gold);
  301.  
  302.     print(fd, "HP: %d/%d", crt_ptr->hpcur, crt_ptr->hpmax);
  303.     print(fd, "   MP: %d/%d\n", crt_ptr->mpcur, crt_ptr->mpmax);
  304.  
  305.     print(fd, "AC: %d", crt_ptr->armor);
  306.     print(fd, "   THAC0: %d\n", crt_ptr->thaco);
  307.  
  308.     print(fd, "Hit: %dd%d+%d\n", crt_ptr->ndice, crt_ptr->sdice,
  309.         crt_ptr->pdice);
  310.  
  311.     print(fd, "Str[%2d]  Dex[%2d]  Con[%2d]  Int[%2d]  Pty[%2d]\n",
  312.           crt_ptr->strength, crt_ptr->dexterity, crt_ptr->constitution,
  313.           crt_ptr->intelligence, crt_ptr->piety);
  314.  
  315.     strcpy(str, "Flags set: ");
  316.     if(crt_ptr->type == PLAYER) {
  317.         print(fd, 
  318.     "Sharp: %ld  Thrust: %ld  Blunt: %ld   Pole: %ld  Missile: %ld\n",
  319.             crt_ptr->proficiency[0], crt_ptr->proficiency[1],
  320.             crt_ptr->proficiency[2], crt_ptr->proficiency[3],
  321.             crt_ptr->proficiency[4]);
  322.         print(fd,
  323.             "Earth: %ld    Wind: %ld   Fire: %ld  Water: %ld\n",
  324.             crt_ptr->realm[0], crt_ptr->realm[1],
  325.             crt_ptr->realm[2], crt_ptr->realm[3]);
  326.         if(F_ISSET(crt_ptr, PBLESS)) strcat(str, "Bless, ");
  327.         if(F_ISSET(crt_ptr, PHIDDN)) strcat(str, "Hidden, ");
  328.         if(F_ISSET(crt_ptr, PINVIS)) strcat(str, "Invis, ");
  329.         if(F_ISSET(crt_ptr, PNOBRD)) strcat(str, "NoBroad, ");
  330.         if(F_ISSET(crt_ptr, PNOLDS)) strcat(str, "NoLong, ");
  331.         if(F_ISSET(crt_ptr, PNOSDS)) strcat(str, "NoShort, ");
  332.         if(F_ISSET(crt_ptr, PNORNM)) strcat(str, "NoName, ");
  333.         if(F_ISSET(crt_ptr, PNOEXT)) strcat(str, "NoExits, ");
  334.         if(F_ISSET(crt_ptr, PNOAAT)) strcat(str, "NoAutoAttk, ");
  335.         if(F_ISSET(crt_ptr, PNOEXT)) strcat(str, "NoWaitMsg, ");
  336.         if(F_ISSET(crt_ptr, PPROTE)) strcat(str, "Protect, ");
  337.         if(F_ISSET(crt_ptr, PDMINV)) strcat(str, "DMInvis, ");
  338.         if(F_ISSET(crt_ptr, PNOCMP)) strcat(str, "Noncompact, ");
  339.         if(F_ISSET(crt_ptr, PMALES)) strcat(str, "Male, ");
  340.         if(F_ISSET(crt_ptr, PWIMPY)) {
  341.             sprintf(temp, "Wimpy%d, ", crt_ptr->WIMPYVALUE);
  342.             strcat(str, temp);
  343.         }
  344.         if(F_ISSET(crt_ptr, PEAVES)) strcat(str, "Eaves, ");
  345.         if(F_ISSET(crt_ptr, PBLIND)) strcat(str, "Blind, ");
  346.         if(F_ISSET(crt_ptr, PCHARM)) strcat(str, "Charmed, ");
  347.         if(F_ISSET(crt_ptr, PLECHO)) strcat(str, "Echo, ");
  348.         if(F_ISSET(crt_ptr, PPOISN)) strcat(str, "Poisoned, ");
  349.         if(F_ISSET(crt_ptr, PDISEA)) strcat(str, "Diseased, ");
  350.         if(F_ISSET(crt_ptr, PLIGHT)) strcat(str, "Light, ");
  351.         if(F_ISSET(crt_ptr, PPROMP)) strcat(str, "Prompt, ");
  352.         if(F_ISSET(crt_ptr, PHASTE)) strcat(str, "Haste, ");
  353.         if(F_ISSET(crt_ptr, PDMAGI)) strcat(str, "D-magic, ");
  354.         if(F_ISSET(crt_ptr, PDINVI)) strcat(str, "D-invis, ");
  355.         if(F_ISSET(crt_ptr, PPRAYD)) strcat(str, "Pray, ");
  356.         if(F_ISSET(crt_ptr, PPREPA)) strcat(str, "Prepared, ");
  357.         if(F_ISSET(crt_ptr, PLEVIT)) strcat(str, "Levitate, ");
  358.         if(F_ISSET(crt_ptr, PANSIC)) strcat(str, "Ansi, ");
  359.         if(F_ISSET(crt_ptr, PRFIRE)) strcat(str, "R-fire, ");
  360.         if(F_ISSET(crt_ptr, PFLYSP)) strcat(str, "Fly, ");
  361.         if(F_ISSET(crt_ptr, PRMAGI)) strcat(str, "R-magic, ");
  362.         if(F_ISSET(crt_ptr, PKNOWA)) strcat(str, "Know-a, ");
  363.         if(F_ISSET(crt_ptr, PNOSUM)) strcat(str, "Nosummon, ");
  364.         if(F_ISSET(crt_ptr, PIGNOR)) strcat(str, "Ignore-a, ");
  365.         if(F_ISSET(crt_ptr, PRCOLD)) strcat(str, "R-cold, ");
  366.         if(F_ISSET(crt_ptr, PBRWAT)) strcat(str, "Breath-wtr,, ");
  367.         if(F_ISSET(crt_ptr, PSSHLD)) strcat(str, "Earth-shld, ");
  368.         if(F_ISSET(crt_ptr, PSILNC)) strcat(str, "Mute, ");
  369.         if(F_ISSET(crt_ptr, PFEARS)) strcat(str, "Fear, ");
  370.         if(F_ISSET(crt_ptr, PPLDGK))
  371.             if(F_ISSET(crt_ptr, PKNGDM)) strcat(str, "Organization 1, ");
  372.             else strcat(str, "Organization 0, ");
  373.     }
  374.     else {
  375.         if(F_ISSET(crt_ptr, MPERMT)) strcat(str, "Perm, ");
  376.         if(F_ISSET(crt_ptr, MINVIS)) strcat(str, "Invis, ");
  377.         if(F_ISSET(crt_ptr, MAGGRE)) strcat(str, "Aggr, ");
  378.         if(F_ISSET(crt_ptr, MGAGGR)) strcat(str, "Good-Aggr, ");
  379.         if(F_ISSET(crt_ptr, MEAGGR)) strcat(str, "Evil-Aggr, ");
  380.         if(F_ISSET(crt_ptr, MGUARD)) strcat(str, "Guard, ");
  381.         if(F_ISSET(crt_ptr, MBLOCK)) strcat(str, "Block, ");
  382.         if(F_ISSET(crt_ptr, MFOLLO)) strcat(str, "Follow, ");
  383.         if(F_ISSET(crt_ptr, MFLEER)) strcat(str, "Flee, ");
  384.         if(F_ISSET(crt_ptr, MSCAVE)) strcat(str, "Scav, ");
  385.         if(F_ISSET(crt_ptr, MMALES)) strcat(str, "Male, ");
  386.         if(F_ISSET(crt_ptr, MPOISS)) strcat(str, "Poison, ");
  387.         if(F_ISSET(crt_ptr, MUNDED)) strcat(str, "Undead, ");
  388.         if(F_ISSET(crt_ptr, MUNSTL)) strcat(str, "No-steal, ");
  389.         if(F_ISSET(crt_ptr, MPOISN)) strcat(str, "Poisoned, ");
  390.         if(F_ISSET(crt_ptr, MMAGIC)) strcat(str, "Magic, ");
  391.         if(F_ISSET(crt_ptr, MHASSC)) strcat(str, "Scavenged, ");
  392.         if(F_ISSET(crt_ptr, MBRETH))
  393.             if(!F_ISSET(crt_ptr,MBRWP1) && !F_ISSET(crt_ptr,MBRWP2))
  394.                 strcat(str, "BR-fire, ");
  395.             else if(F_ISSET(crt_ptr,MBRWP1) && !F_ISSET(crt_ptr,MBRWP2))
  396.                 strcat(str, "BR-acid, ");
  397.             else if(!F_ISSET(crt_ptr,MBRWP1) && F_ISSET(crt_ptr,MBRWP2))
  398.                 strcat(str, "BR-frost, ");
  399.             else
  400.                 strcat(str, "BR-gas, ");
  401.         if(F_ISSET(crt_ptr, MMGONL)) strcat(str, "Magic-only, ");
  402.         if(F_ISSET(crt_ptr, MBLNDR)) strcat(str, "Blinder, ");
  403.         if(F_ISSET(crt_ptr, MBLIND)) strcat(str, "Blind, ");
  404.         if(F_ISSET(crt_ptr, MCHARM)) strcat(str, "Charmed, ");
  405.         if(F_ISSET(crt_ptr, MTESTM)) strcat(str, "Test, ");
  406.         if(F_ISSET(crt_ptr, MSILNC)) strcat(str, "Mute, ");
  407.         if(F_ISSET(crt_ptr, MMAGIO)) strcat(str, "Cast-percent, ");
  408.         if(F_ISSET(crt_ptr, MRBEFD)) strcat(str, "Resist-stun, ");
  409.         if(F_ISSET(crt_ptr, MNOCIR)) strcat(str, "No-circle, ");
  410.         if(F_ISSET(crt_ptr, MDINVI)) strcat(str, "Detect-invis, ");
  411.         if(F_ISSET(crt_ptr, MENONL)) strcat(str, "Enchant-only, ");
  412.         if(F_ISSET(crt_ptr, MRMAGI)) strcat(str, "Resist-magic, ");
  413.         if(F_ISSET(crt_ptr, MTALKS)) strcat(str, "Talks, ");
  414.         if(F_ISSET(crt_ptr, MUNKIL)) strcat(str, "Unkillable, ");
  415.         if(F_ISSET(crt_ptr, MNRGLD)) strcat(str, "NonrandGold, ");
  416.         if(F_ISSET(crt_ptr, MTLKAG)) strcat(str, "Talk-aggr, ");
  417.         if(F_ISSET(crt_ptr, MENEDR)) strcat(str, "Energy Drain, ");
  418.         if(F_ISSET(crt_ptr, MDISEA)) strcat(str, "Disease, ");
  419.         if(F_ISSET(crt_ptr, MDISIT)) strcat(str, "Dissolve, ");
  420.         if(F_ISSET(crt_ptr, MPURIT)) strcat(str, "Purchase, ");
  421.         if(F_ISSET(crt_ptr, MTRADE)) strcat(str, "Trade, ");
  422.         if(F_ISSET(crt_ptr, MFEARS)) strcat(str, "Fear, ");
  423.         if(F_ISSET(crt_ptr, MPGUAR)) strcat(str, "P-Guard, ");
  424.         if(F_ISSET(crt_ptr, MDEATH)) strcat(str, "Death scene, ");
  425.         if(F_ISSET(crt_ptr, MDMFOL)) strcat(str, "DM Follow, ");
  426.         if(F_ISSET(crt_ptr, MPLDGK) ) 
  427.             if(F_ISSET(crt_ptr, MKNGDM)) strcat(str, "Pledge 1, ");
  428.             else strcat(str, "Pledge 0, ");
  429.         if(F_ISSET(crt_ptr, MRSCND) ) 
  430.             if(F_ISSET(crt_ptr, MKNGDM)) strcat(str, "Rescind 1, ");
  431.             else strcat(str, "Rescind 0, ");
  432.     }
  433.  
  434.     if(strlen(str) > 11) {
  435.         str[strlen(str)-2] = '.';
  436.         str[strlen(str)-1] = 0;
  437.     }
  438.     else
  439.         strcat(str, "None.");
  440.     print(fd, "%s\n", str);
  441.  
  442. }
  443.  
  444. /************************************************************************/
  445. /*                stat_obj                */
  446. /************************************************************************/
  447.  
  448. /*  Display information on object given to player given.        */
  449.  
  450. int stat_obj(ply_ptr, obj_ptr)
  451. creature    *ply_ptr;
  452. object        *obj_ptr;
  453. {
  454.     char    str[1024];
  455.     int    fd;
  456.  
  457.     fd = ply_ptr->fd;
  458.  
  459.     print(fd, "Name: %s\n", obj_ptr->name);
  460.     print(fd, "Desc: %s\n", obj_ptr->description);
  461.     print(fd, "Use:  %s\n", obj_ptr->use_output);
  462.     print(fd, "Keys: %s %+20s %+20s\n\n",obj_ptr->key[0],obj_ptr->key[1], obj_ptr->key[2]);
  463.     print(fd, "Hit: %dd%d + %d", obj_ptr->ndice, obj_ptr->sdice,
  464.         obj_ptr->pdice);
  465.     if(obj_ptr->adjustment)
  466.         print(fd, " (+%d)\n", obj_ptr->adjustment);
  467.     else
  468.         print(fd, "\n");
  469.  
  470.     print(fd, "Shots: %d/%d\n", obj_ptr->shotscur, obj_ptr->shotsmax);
  471.  
  472.     print(fd, "Type: ");
  473.     if(obj_ptr->type <= MISSILE) {
  474.         switch(obj_ptr->type) {
  475.         case SHARP: print(fd, "sharp"); break;
  476.         case THRUST: print(fd, "thrusting"); break;
  477.         case BLUNT: print(fd, "blunt"); break;
  478.         case POLE: print(fd, "pole"); break;
  479.         case MISSILE: print(fd, "missile"); break;
  480.         }
  481.         print(fd, " weapon.\n");
  482.     }
  483.     else
  484.         print(fd, "%d\n", obj_ptr->type);
  485.  
  486.     print(fd, "AC: %2.2d", obj_ptr->armor);
  487.     print(fd, "   Value: %5.5d", obj_ptr->value);
  488.     print(fd, "   Weight: %2.2d", obj_ptr->weight);
  489.     if(obj_ptr->questnum)
  490.         print(fd, "   Quest: %d\n", obj_ptr->questnum);
  491.     else
  492.         print(fd, "\n");
  493.  
  494.     strcpy(str, "Flags set: ");
  495.     if(F_ISSET(obj_ptr, OPERMT)) strcat(str, "Pperm, ");
  496.     if(F_ISSET(obj_ptr, OHIDDN)) strcat(str, "Hidden, ");
  497.     if(F_ISSET(obj_ptr, OINVIS)) strcat(str, "Invis, ");
  498.     if(F_ISSET(obj_ptr, OCONTN)) strcat(str, "Cont, ");
  499.     if(F_ISSET(obj_ptr, OWTLES)) strcat(str, "Wtless, ");
  500.     if(F_ISSET(obj_ptr, OTEMPP)) strcat(str, "Tperm, ");
  501.     if(F_ISSET(obj_ptr, OPERM2)) strcat(str, "Iperm, ");
  502.     if(F_ISSET(obj_ptr, ONOMAG)) strcat(str, "Nomage, ");
  503.     if(F_ISSET(obj_ptr, OLIGHT)) strcat(str, "Light, ");
  504.     if(F_ISSET(obj_ptr, OGOODO)) strcat(str, "Good, ");
  505.     if(F_ISSET(obj_ptr, OEVILO)) strcat(str, "Evil, ");
  506.     if(F_ISSET(obj_ptr, OENCHA)) strcat(str, "Ench, ");
  507.     if(F_ISSET(obj_ptr, ONOFIX)) strcat(str, "Nofix, ");
  508.     if(F_ISSET(obj_ptr, OCLIMB)) strcat(str, "Climbing, ");
  509.     if(F_ISSET(obj_ptr, ONOTAK)) strcat(str, "Notake, ");
  510.     if(F_ISSET(obj_ptr, OSCENE)) strcat(str, "Scenery, ");
  511.     if(F_ISSET(obj_ptr, OSIZE1) || F_ISSET(obj_ptr, OSIZE2))
  512.         strcat(str, "Sized, ");
  513.     if(F_ISSET(obj_ptr, ORENCH)) strcat(str, "RandEnch, ");
  514.     if(F_ISSET(obj_ptr, OCURSE)) strcat(str, "Cursed, ");
  515.     if(F_ISSET(obj_ptr, OWEARS)) strcat(str, "Worn, ");
  516.     if(F_ISSET(obj_ptr, OUSEFL)) strcat(str, "Use-floor, ");
  517.     if(F_ISSET(obj_ptr, OCNDES)) strcat(str, "Devours, ");
  518.     if(F_ISSET(obj_ptr, ONOMAL)) strcat(str, "Nomale, ");
  519.     if(F_ISSET(obj_ptr, ONOFEM)) strcat(str, "Nofemale, ");
  520.     if(F_ISSET(obj_ptr, ONSHAT)) strcat(str, "Shatterproof, ");
  521.     if(F_ISSET(obj_ptr, OALCRT)) strcat(str, "Always crit, ");
  522.     if(F_ISSET(obj_ptr, ODDICE)) strcat(str, "NdS damage, ");
  523.     if(F_ISSET(obj_ptr, OPLDGK))
  524.         if(F_ISSET(obj_ptr, OKNGDM)) strcat(str, "Organization 1, ");
  525.         else  strcat(str, "Organization 0, ");
  526.     if(F_ISSET(obj_ptr, OCLSEL)){
  527.         strcat(str, "Cls-Sel: ");
  528.         if (F_ISSET(obj_ptr, OASSNO)) strcat(str, "A, ");
  529.         if (F_ISSET(obj_ptr, OBARBO)) strcat(str, "B, ");
  530.         if (F_ISSET(obj_ptr, OCLERO)) strcat(str, "C, ");
  531.         if (F_ISSET(obj_ptr, OFIGHO)) strcat(str, "F, ");
  532.         if (F_ISSET(obj_ptr, OMAGEO)) strcat(str, "M, ");
  533.         if (F_ISSET(obj_ptr, OPALAO)) strcat(str, "P, ");
  534.         if (F_ISSET(obj_ptr, ORNGRO)) strcat(str, "R, ");
  535.         if (F_ISSET(obj_ptr, OTHIEO)) strcat(str, "T, ");
  536.     }
  537.  
  538.  
  539.     if(strlen(str) > 11) {
  540.         str[strlen(str)-2] = '.';
  541.         str[strlen(str)-1] = 0;
  542.     }
  543.     else
  544.         strcat(str, "None.");
  545.     print(fd, "%s\n", str);
  546.  
  547. }
  548.  
  549. /**********************************************************************/
  550. /*                dm_add_rom                  */
  551. /**********************************************************************/
  552.  
  553. /* This function allows a DM to add a new, empty room to the current  */
  554. /* database of rooms.                              */
  555.  
  556. int dm_add_rom(ply_ptr, cmnd)
  557. creature    *ply_ptr;
  558. cmd        *cmnd;
  559. {
  560.     room    *new_rom;
  561.     char    file[80];
  562.     int    fd, ff;
  563.  
  564.     fd = ply_ptr->fd;
  565.  
  566.     if(ply_ptr->class < DM)
  567.         return(PROMPT);
  568.  
  569.     if(cmnd->val[1] < 2) {
  570.         print(fd, "Add what?\n");
  571.         return(0);
  572.     }
  573.  
  574.     sprintf(file, "%s/r%05d", ROOMPATH, cmnd->val[1]);
  575.     ff = open(file, O_RDONLY, 0);
  576.     if(ff >= 0) {
  577.         close(ff);
  578.         print(fd, "Room already exists.\n");
  579.         return(0);
  580.     }
  581.  
  582.     new_rom = (room *)malloc(sizeof(room));
  583.     if(!new_rom)
  584.         merror("dm_add_room", FATAL);
  585.     new_rom->rom_num = cmnd->val[1];
  586.     sprintf(new_rom->name, "Room #%d", cmnd->val[1]);
  587.  
  588.     zero(new_rom, sizeof(room));
  589.  
  590.     ff = open(file, O_RDWR | O_CREAT, ACC);
  591.     if(ff < 0) {
  592.         print(fd, "Error: Unable to open file.\n");
  593.         return(0);
  594.     }
  595.  
  596.     if(write_rom(ff, new_rom, 0) < 0) {
  597.         print(fd, "Write failed.\n");
  598.         return(0);
  599.     }
  600.  
  601.     close(ff);
  602.     free(new_rom);
  603.     print(fd, "Room #%d created.\n", cmnd->val[1]);
  604.     return(0);
  605.  
  606. }
  607.  
  608. int dm_spy(ply_ptr, cmnd)
  609. creature     *ply_ptr;
  610. cmd        *cmnd;
  611. {
  612.     int         fd, i;
  613.     creature    *crt_ptr;
  614.  
  615.     if(ply_ptr->class < CARETAKER)
  616.         return(PROMPT);
  617.  
  618.     fd = ply_ptr->fd;
  619.  
  620.     if(cmnd->num < 2 && !F_ISSET(ply_ptr, PSPYON)) {
  621.         print(fd, "Spy on whom?\n");
  622.         return(0);
  623.     }
  624.     
  625.     if(F_ISSET(ply_ptr, PSPYON)) {
  626.         for(i=0; i<Tablesize; i++)
  627.             if(Spy[i] == fd) Spy[i] = -1;
  628.         F_CLR(ply_ptr, PSPYON);
  629.         print(fd, "Spy mode off.\n");
  630.         return;
  631.     }
  632.  
  633.     cmnd->str[1][0] = up(cmnd->str[1][0]);
  634.     crt_ptr = find_who(cmnd->str[1]);
  635.     if(!crt_ptr) {
  636.         print(fd, "Spy on whom?  Use full names.\n");
  637.         return(0);
  638.     }
  639.  
  640.     if(Spy[crt_ptr->fd] > -1) {
  641.         print(fd, "That person is being spied on already.\n");
  642.         return(0);
  643.     }
  644.  
  645.         if(crt_ptr->class >= CARETAKER) {
  646.         if(!(!strcmp(ply_ptr->name, DMNAME2) || !strcmp(ply_ptr->name, DMNAME6))){
  647.         ANSI(crt_ptr->fd,RED);
  648.         print(crt_ptr->fd,"%s is observing you.\n",ply_ptr->name);
  649.         ANSI(crt_ptr->fd,WHITE);
  650.         output_buf();
  651.         }
  652.     }
  653.     Spy[crt_ptr->fd] = ply_ptr->fd;
  654.     F_SET(ply_ptr, PSPYON);
  655.     F_SET(ply_ptr, PDMINV);
  656.     print(fd, "Spy on.  Type *spy to turn it off.\n");
  657.     return(0);
  658. }
  659.  
  660.